#    Copyright 2008, 2009 Tri-County Electric Cooperative, St. Matthews, South Carolina
#    This file is part of COOPGIS.
#    COOPGIS is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#    COOPGIS is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#    You should have received a copy of the GNU General Public License
#    along with COOPGIS.  If not, see <http://www.gnu.org/licenses/>.
#Test_12_31_2009_LatestVersion
import sys
NeededPaths=['/opt/coopgis/djangoproject/include', '/opt/coopgis/djangoproject']
for path in NeededPaths:
    if not path in sys.path:
        sys.path.append(path)


from django.conf.urls import *
import views
import djangoproject

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    #Inventory Collection Application Views, Commented out on the Server [functionality will be in Staker w/ Logins]
    (r'^inventorycollection/admin/', 'views.InventoryCollection.InventoryCollectionAdmin'),
    (r'^inventorycollection/', 'djangoproject.views.InventoryCollection.InventoryCollection'),
    #Map Setup Application Views
    (r'^mapsetup/template/', 'djangoproject.views.MapSetup.MapTemplateSetup'),
    (r'^mapsetup/', 'djangoproject.views.MapSetup.MapSetup'),
    #Joint Use Editor Application Views
    (r'^jointuseeditor/report/', 'djangoproject.views.JointUseEditor.JointUseReport'),
    (r'^jointuseeditor/', 'djangoproject.views.JointUseEditor.JointUseEditor'),
    #Assembly Editor Application Views
    (r'^assemblyeditor/', 'djangoproject.views.AssemblyEditor.AssemblyEditor'),
    #Cost Estimate Application
    (r'^costestimatecontract/', 'djangoproject.views.CostEstimate.CostEstimateContract'),
    (r'^costestimate/', 'djangoproject.views.CostEstimate.CostEstimate'),
    #GPS Trace Application
    (r'^gpstrace/', 'djangoproject.views.Geography.GPSTrace'),
    (r'^gpstraceinprogress/', 'djangoproject.views.Geography.GPSTraceInProgress'),
    #Maintenance Application
    (r'^condition/editor/', 'djangoproject.views.Maintenance.ConditionEditor'),
    (r'^condition/dispatch/', 'djangoproject.views.Maintenance.ConditionDispatch'),
    (r'^condition/create/(\d+)/', 'djangoproject.views.Maintenance.ConditionCreate'),
    (r'^condition/create/', 'djangoproject.views.Maintenance.ConditionCreate'),

    (r'^condition/work/(\d+)/', 'djangoproject.views.Maintenance.ConditionWork'),
    (r'^condition/work/', 'djangoproject.views.Maintenance.ConditionWork'),

    (r'^condition/review/(\d+)/', 'djangoproject.views.Maintenance.ConditionReview'),
    (r'^condition/review/', 'djangoproject.views.Maintenance.ConditionReview'),
    
    (r'^maintenance/outdoorlighting/', 'djangoproject.views.Maintenance.OutdoorLighting'),

    #Staker Related Views
    (r'^staker/workorderreview/','djangoproject.views.Staker.ReviewWorkOrders'),
    #Not Sure of the proper REGEX, so use this workaround for now for up to 9 digits to get the Staker Work Order ID...
    (r'^staker/report/(\w{1})/', 'djangoproject.views.Staker.GenerateReport'),
    (r'^staker/report/(\w{2})/', 'djangoproject.views.Staker.GenerateReport'),
    (r'^staker/report/(\w{3})/', 'djangoproject.views.Staker.GenerateReport'),
    (r'^staker/report/(\w{4})/', 'djangoproject.views.Staker.GenerateReport'),
    (r'^staker/report/(\w{5})/', 'djangoproject.views.Staker.GenerateReport'),
    (r'^staker/report/(\w{6})/', 'djangoproject.views.Staker.GenerateReport'),
    (r'^staker/report/(\w{7})/', 'djangoproject.views.Staker.GenerateReport'),
    (r'^staker/report/(\w{8})/', 'djangoproject.views.Staker.GenerateReport'),
    (r'^staker/report/(\w{9})/', 'djangoproject.views.Staker.GenerateReport'),

    #Not Sure of the proper REGEX, so use this workaround for now for up to 9 digits to get the Staker Work Order ID...
    (r'^staker/quickgenerateworkorder/(\w{1})/', 'djangoproject.views.Staker.QuickGenerateWorkOrder'),
    (r'^staker/quickgenerateworkorder/(\w{2})/', 'djangoproject.views.Staker.QuickGenerateWorkOrder'),
    (r'^staker/quickgenerateworkorder/(\w{3})/', 'djangoproject.views.Staker.QuickGenerateWorkOrder'),
    (r'^staker/quickgenerateworkorder/(\w{4})/', 'djangoproject.views.Staker.QuickGenerateWorkOrder'),
    (r'^staker/quickgenerateworkorder/(\w{5})/', 'djangoproject.views.Staker.QuickGenerateWorkOrder'),
    (r'^staker/quickgenerateworkorder/(\w{6})/', 'djangoproject.views.Staker.QuickGenerateWorkOrder'),
    (r'^staker/quickgenerateworkorder/(\w{7})/', 'djangoproject.views.Staker.QuickGenerateWorkOrder'),
    (r'^staker/quickgenerateworkorder/(\w{8})/', 'djangoproject.views.Staker.QuickGenerateWorkOrder'),
    (r'^staker/quickgenerateworkorder/(\w{9})/', 'djangoproject.views.Staker.QuickGenerateWorkOrder'),

    #Not Sure of the proper REGEX, so use this workaround for now for up to 9 digits to get the Staker Work Order ID...
    (r'^staker/reportviewscanned/(\w{1})/', 'djangoproject.views.Staker.ViewScanned'),
    (r'^staker/reportviewscanned/(\w{2})/', 'djangoproject.views.Staker.ViewScanned'),
    (r'^staker/reportviewscanned/(\w{3})/', 'djangoproject.views.Staker.ViewScanned'),
    (r'^staker/reportviewscanned/(\w{4})/', 'djangoproject.views.Staker.ViewScanned'),
    (r'^staker/reportviewscanned/(\w{5})/', 'djangoproject.views.Staker.ViewScanned'),
    (r'^staker/reportviewscanned/(\w{6})/', 'djangoproject.views.Staker.ViewScanned'),
    (r'^staker/reportviewscanned/(\w{7})/', 'djangoproject.views.Staker.ViewScanned'),
    (r'^staker/reportviewscanned/(\w{8})/', 'djangoproject.views.Staker.ViewScanned'),
    (r'^staker/reportviewscanned/(\w{9})/', 'djangoproject.views.Staker.ViewScanned'),

    #Not Sure of the proper REGEX, so use this workaround for now for up to 9 digits to get the Staker Work Order ID...
    (r'^staker/reportviewinspected/(\w{1})/', 'djangoproject.views.Staker.ViewInspected'),
    (r'^staker/reportviewinspected/(\w{2})/', 'djangoproject.views.Staker.ViewInspected'),
    (r'^staker/reportviewinspected/(\w{3})/', 'djangoproject.views.Staker.ViewInspected'),
    (r'^staker/reportviewinspected/(\w{4})/', 'djangoproject.views.Staker.ViewInspected'),
    (r'^staker/reportviewinspected/(\w{5})/', 'djangoproject.views.Staker.ViewInspected'),
    (r'^staker/reportviewinspected/(\w{6})/', 'djangoproject.views.Staker.ViewInspected'),
    (r'^staker/reportviewinspected/(\w{7})/', 'djangoproject.views.Staker.ViewInspected'),
    (r'^staker/reportviewinspected/(\w{8})/', 'djangoproject.views.Staker.ViewInspected'),
    (r'^staker/reportviewinspected/(\w{9})/', 'djangoproject.views.Staker.ViewInspected'),

    #Not Sure of the proper REGEX, so use this workaround for now for up to 9 digits to get the Staker Work Order ID...
    (r'^staker/addremovereport/(\w{1})/', 'djangoproject.views.Staker.GenerateAddRemoveReport'),
    (r'^staker/addremovereport/(\w{2})/', 'djangoproject.views.Staker.GenerateAddRemoveReport'),
    (r'^staker/addremovereport/(\w{3})/', 'djangoproject.views.Staker.GenerateAddRemoveReport'),
    (r'^staker/addremovereport/(\w{4})/', 'djangoproject.views.Staker.GenerateAddRemoveReport'),
    (r'^staker/addremovereport/(\w{5})/', 'djangoproject.views.Staker.GenerateAddRemoveReport'),
    (r'^staker/addremovereport/(\w{6})/', 'djangoproject.views.Staker.GenerateAddRemoveReport'),
    (r'^staker/addremovereport/(\w{7})/', 'djangoproject.views.Staker.GenerateAddRemoveReport'),
    (r'^staker/addremovereport/(\w{8})/', 'djangoproject.views.Staker.GenerateAddRemoveReport'),
    (r'^staker/addremovereport/(\w{9})/', 'djangoproject.views.Staker.GenerateAddRemoveReport'),


    #Not Sure of the proper REGEX, so use this workaround for now for up to 9 digits to get the Staker Work Order ID...
    (r'^staker/primarysecondaryreport/(\w{1})/', 'djangoproject.views.Staker.PrimarySecondaryReport'),
    (r'^staker/primarysecondaryreport/(\w{2})/', 'djangoproject.views.Staker.PrimarySecondaryReport'),
    (r'^staker/primarysecondaryreport/(\w{3})/', 'djangoproject.views.Staker.PrimarySecondaryReport'),
    (r'^staker/primarysecondaryreport/(\w{4})/', 'djangoproject.views.Staker.PrimarySecondaryReport'),
    (r'^staker/primarysecondaryreport/(\w{5})/', 'djangoproject.views.Staker.PrimarySecondaryReport'),
    (r'^staker/primarysecondaryreport/(\w{6})/', 'djangoproject.views.Staker.PrimarySecondaryReport'),
    (r'^staker/primarysecondaryreport/(\w{7})/', 'djangoproject.views.Staker.PrimarySecondaryReport'),
    (r'^staker/primarysecondaryreport/(\w{8})/', 'djangoproject.views.Staker.PrimarySecondaryReport'),
    (r'^staker/primarysecondaryreport/(\w{9})/', 'djangoproject.views.Staker.PrimarySecondaryReport'),


    #Not Sure of the proper REGEX, so use this workaround for now for up to 9 digits to get the Staker Work Order ID...
    (r'^staker/(\w{1})/', 'djangoproject.views.StakerAssemblyEditor.AssemblyEditor'),
    (r'^staker/(\w{2})/', 'djangoproject.views.StakerAssemblyEditor.AssemblyEditor'),
    (r'^staker/(\w{3})/', 'djangoproject.views.StakerAssemblyEditor.AssemblyEditor'),
    (r'^staker/(\w{4})/', 'djangoproject.views.StakerAssemblyEditor.AssemblyEditor'),
    (r'^staker/(\w{5})/', 'djangoproject.views.StakerAssemblyEditor.AssemblyEditor'),
    (r'^staker/(\w{6})/', 'djangoproject.views.StakerAssemblyEditor.AssemblyEditor'),
    (r'^staker/(\w{7})/', 'djangoproject.views.StakerAssemblyEditor.AssemblyEditor'),
    (r'^staker/(\w{8})/', 'djangoproject.views.StakerAssemblyEditor.AssemblyEditor'),
    (r'^staker/(\w{9})/', 'djangoproject.views.StakerAssemblyEditor.AssemblyEditor'),
    
    (r'^gisreport/duplicateoldmapnumbers/', 'djangoproject.views.GISReport.DuplicateOldMapNumbers'),
    (r'^gisreport/mapnumbererrors/', 'djangoproject.views.GISReport.MapNumberErrors'),
    (r'^gisreport/duplicatepoles/','djangoproject.views.GISReport.DuplicatePoles'),
    (r'^gisreport/improperlyarchivedassemblies/','djangoproject.views.GISReport.ImproperlyArchivedAssemblies'),
    (r'^gisreport/unprotectedassemblyspans/', 'djangoproject.views.GISReport.UnprotectedAssemblySpans'),
    (r'^gisreport/primarysecondaryserviceindicatorcheck/', 'djangoproject.views.GISReport.PrimarySecondaryServiceIndicatorCheck'),
    (r'^gisreport/tagnumber/', 'djangoproject.views.GISReport.TagNumber'),
    (r'^gisreport/emptylocations/', 'djangoproject.views.GISReport.EmptyLocations'),
    (r'^gisreport/oldtransformers/', 'djangoproject.views.GISReport.OldTransformers'),
    (r'^gisreport/stationswithoutassemblies/','djangoproject.views.GISReport.StationsWithoutAssemblies'),

    (r'^gisreport/updatesinglephaselines/', 'djangoproject.views.GISReport.UpdateSinglePhaseLines'),

    (r'^gisreport/assetreport/', 'djangoproject.views.GISReport.AssetReport'),
    (r'^gisreport/amrgisphaseupdatelogview/', 'djangoproject.views.GISReport.AMRGISPhaseUpdateLogView'),
    (r'^gisreport/nocopperpoles/', 'djangoproject.views.GISReport.NoCopperPoles'),
    (r'^gisreport/showduplicategismeternumbers/', 'djangoproject.views.GISReport.ShowDuplicateGISMeterNumbers'),
    (r'^gisreport/lengthofeachcircuitreport/', 'djangoproject.views.GISReport.LengthOfEachCircuitReport'),

    #outdoor lighting reports
    (r'^gisreport/outdoorlighting/conditionsbycircuitnumber/', 'djangoproject.views.GISReport.OutdoorLightingConditionsByCircuitNumber'),
    (r'^gisreport/outdoorlighting/sendtobilling/', 'djangoproject.views.GISReport.OutdoorLightingSendToBilling'),
    (r'^gisreport/outdoorlighting/idle/', 'djangoproject.views.GISReport.OutdoorLightingIdle'),
    (r'^gisreport/outdoorlighting/uniquelightmapnumber/', 'djangoproject.views.GISReport.OutdoorLightingUniqueLightMapNumber'),
    (r'^gisreport/vegetationmanager/jobspanlength/', 'djangoproject.views.GISReport.VegetationManagerJobSpanLength'),
    (r'^gisreport/stakerreportsummary/', 'djangoproject.views.GISReport.StakerReportSummary'),

    (r'^gisreport/', 'djangoproject.views.GISReport.MainMenu'),

    (r'^staker/stakerworkorderhistoryreport/', 'djangoproject.views.Staker.StakerWorkOrderHistoryReport'),
    (r'^staker/', 'djangoproject.views.Staker.MainMenu'),
    

    #Warehouse related views, in their temporary home in the substation files until this pilot project is completed.
    (r'^warehouse/meterinventorycheckinout/', 'djangoproject.views.Substation.WarehouseMeterInventoryCheckInOut'),
    (r'^warehouse/meterinspectionchoices/', 'djangoproject.views.Substation.WarehouseMeterInspectionChoices'),



    #Substation Maintenance Related Views
    #Not Sure of the proper REGEX, so use this workaround for now for up to 3 digits to get the Substation ID...
    (r'^substation/inspection/(\w{1})/equipment/(\w{1})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),
    (r'^substation/inspection/(\w{2})/equipment/(\w{1})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),
    (r'^substation/inspection/(\w{3})/equipment/(\w{1})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),

    (r'^substation/inspection/(\w{1})/equipment/(\w{2})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),
    (r'^substation/inspection/(\w{2})/equipment/(\w{2})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),
    (r'^substation/inspection/(\w{3})/equipment/(\w{2})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),

    (r'^substation/inspection/(\w{1})/equipment/(\w{3})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),
    (r'^substation/inspection/(\w{2})/equipment/(\w{3})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),
    (r'^substation/inspection/(\w{3})/equipment/(\w{3})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),

    (r'^substation/inspection/(\w{1})/equipment/(\w{4})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),
    (r'^substation/inspection/(\w{2})/equipment/(\w{4})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),
    (r'^substation/inspection/(\w{3})/equipment/(\w{4})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),

    (r'^substation/inspection/(\w{1})/equipment/(\w{5})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),
    (r'^substation/inspection/(\w{2})/equipment/(\w{5})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),
    (r'^substation/inspection/(\w{3})/equipment/(\w{5})/', 'djangoproject.views.Substation.SubstationEquipmentInspection'),

    (r'^substation/inspection/(\w{1})/', 'djangoproject.views.Substation.SubstationInspection'),
    (r'^substation/inspection/(\w{2})/', 'djangoproject.views.Substation.SubstationInspection'),
    (r'^substation/inspection/(\w{3})/', 'djangoproject.views.Substation.SubstationInspection'),

    (r'^substation/equipmenttest/', 'djangoproject.views.Substation.SubstationEquipmentTest'),
    (r'^substation/equipmentsetting/', 'djangoproject.views.Substation.SubstationEquipmentSetting'),
    (r'^substation/equipment/', 'djangoproject.views.Substation.SubstationEquipmentSetup'),
    (r'^substation/equipmenttemplate/', 'djangoproject.views.Substation.SubstationEquipmentTemplateSetup'),
    (r'^substation/inspectionchoices/', 'djangoproject.views.Substation.InspectionChoices'),
    (r'^substation/equipmentmodeltype/', 'djangoproject.views.Substation.EquipmentModelType'),
    (r'^substation/substationsetup/', 'djangoproject.views.Substation.SubstationSetup'),
    (r'^substation/circuit/', 'djangoproject.views.Substation.SubstationCircuit'),
    (r'^substation/equipmentreport/', 'djangoproject.views.Substation.SubstationEquipmentReport'),
    (r'^substation/descriptionreport/', 'djangoproject.views.Substation.SubstationDescriptionReport'),

    (r'^substation/', 'djangoproject.views.Substation.SubstationMainMenu'),
    #General Module Related Views
    (r'^general/companysetup/', 'djangoproject.views.General.CompanySetup'),
    (r'^general/voltagesetup/', 'djangoproject.views.General.VoltageSetup'),
    (r'^general/categorizecompatibleunit/', 'djangoproject.views.General.CategorizeCompatibleUnit'),
    (r'^general/', 'djangoproject.views.General.GeneralMainMenu'),
    #Circuit Analysis Related Views
    (r'^circuitanalysis/', 'djangoproject.views.CircuitAnalysis.CircuitAnalysis'), 


    #Road Editor Application Views
    (r'^roadeditor/', 'djangoproject.views.RoadEditor.RoadEditor'),
    #Landmark Editor Application Views
    (r'^landmarkpointeditor/', 'djangoproject.views.LandmarkEditor.LandmarkPointEditor'),
    (r'^landmarklineeditor/', 'djangoproject.views.LandmarkEditor.LandmarkLineEditor'),
    (r'^landmarkpolygoneditor/', 'djangoproject.views.LandmarkEditor.LandmarkPolygonEditor'),


    #Vegetation Management Application Views
    (r'^vegetationmanager/createeditjob/', 'djangoproject.views.VegetationManager.VegetationManagerCreateEditJob'),
    (r'^vegetationmanager/workjob/', 'djangoproject.views.VegetationManager.VegetationManagerWorkJob'),
    (r'^vegetationmanager/', 'djangoproject.views.VegetationManager.MainMenu'),



    #PoleTreatment Application Views
    (r'^poletreatment/report/', 'djangoproject.views.PoleTreatment.PoleTreatmentReport'),
    (r'^poletreatment/', 'djangoproject.views.PoleTreatment.PoleTreatment'),
    #GroundRod Application Views
    (r'^groundrodtest/report/', 'djangoproject.views.GroundRodTest.GroundRodTestReport'),
    (r'^groundrodtest/', 'djangoproject.views.GroundRodTest.GroundRodTest'),

    #Board District Application Views
    (r'^boarddistrict/', 'djangoproject.views.BoardDistrict.BoardDistrict'),
    #Login, Logout, and Administrative Views
    (r'^login/', 'djangoproject.views.Misc.Login'),
    #(r'^admin/(.*)', admin.site.root),
    (r'^admin/', include(admin.site.urls)),
    (r'^logout/', 'djangoproject.views.Misc.Logout'),
    (r'^changepassword/', 'djangoproject.views.Misc.ChangePassword'),
    (r'^managementconsole/createbackup/', 'djangoproject.views.ManagementConsole.CreateBackup'),
    (r'^managementconsole/commandtracker/', 'djangoproject.views.ManagementConsole.CommandTracker'),
    (r'^managementconsole/', 'djangoproject.views.ManagementConsole.MainMenu'),

    #Update Related Views
    (r'^clientstartupdate/', 'djangoproject.views.Update.ClientStartUpdate'), 
    (r'^clientdisplayupdatestatus/(\w{22})/', 'djangoproject.views.Update.ClientDisplayUpdateStatus'), 
    (r'^serverimportcommands/(\w{22})/', 'djangoproject.views.Update.ServerImportCommands'), #Instructs Server to Create DB Records for Commands
    (r'^serverprocesscommands/(\w{22})/', 'djangoproject.views.Update.ServerProcessCommands'), #Instructs Server to Process Commands
    (r'^serverupdaterepository/', 'djangoproject.views.Update.ServerUpdateRepository'), #Instructs Server to Refresh Downloadable Files
    (r'^servergetsizeofdatabasefile/', 'djangoproject.views.Update.ServerGetSizeOfDatabaseFile'),
    #Generate/Download Shape Files View
    (r'^shape/', 'djangoproject.views.Misc.Shape'),
    #Configure Bluetooth View
    (r'^configurebluetooth/', 'djangoproject.views.Misc.ConfigureBluetooth'),
    #Viewer Application View
    (r'^viewer/(\d+)/', 'djangoproject.views.MapViewer.Viewer'),  #For Specific Station ID
    (r'^viewer/', 'djangoproject.views.MapViewer.Viewer'), 
    (r'^printer/', 'djangoproject.views.MapViewer.Printer'), 
    (r'^assetviewer/', 'djangoproject.views.MapViewer.AssetViewer'),
    #System Summary Mini Application
    (r'^systemsummary/', 'djangoproject.views.Misc.SystemSummary'),
    (r'^rebuildsymbology/(\d+)/', 'djangoproject.views.Misc.RebuildSpecifiedSymbology'),
    #Development Test 
    (r'^test/', 'djangoproject.views.Misc.DevelopmentTest'),
    #Default/Main Menu View
    (r'^', 'djangoproject.views.Misc.index'),

)
